package cn.wmw.xyy.fallback;

import cn.wmw.result.JsonResult;
import cn.wmw.xyy.exception.GlobalExceptionEnum;
import cn.wmw.xyy.feign.CourseUserLearnFeignClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseUserLearnFeignClientFallbackFactory implements FallbackFactory<CourseUserLearnFeignClient> {
    @Override
    public CourseUserLearnFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
            return new CourseUserLearnFeignClient() {
                @Override
                public JsonResult getByCourseId(Long courseId, Long loginId) {
                    return JsonResult.error(GlobalExceptionEnum.ERROR.getMessage(),GlobalExceptionEnum.ERROR.getCode());
                }
        };
    }
}
